home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / Mig.man < prev    next >
Encoding:
Text File  |  1990-04-06  |  14.2 KB  |  399 lines

  1.  
  2.  
  3.  
  4. Mig                   C Library Procedures                    Mig
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      Mig - obtain or update information in the migration informa-
  12.      tion database.
  13.  
  14. SSYYNNOOPPSSIISS
  15.      ##iinncclluuddee  <<mmiigg..hh>>
  16.  
  17.      Mig_Info *
  18.      MMiigg__GGeettIInnffoo(_s_p_r_i_t_e_I_D)
  19.  
  20.      int
  21.      MMiigg__GGeettAAllllIInnffoo(_i_n_f_o_A_r_r_a_y, _n_u_m_H_o_s_t_s)
  22.  
  23.      int
  24.      MMiigg__RReeqquueessttIIddlleeHHoossttss(_n_u_m_H_o_s_t_s, _p_r_i_o_r_i_t_y, _f_l_a_g_s, _c_a_l_l_B_a_c_k_P_t_r, _h_o_s_t_A_r_r_a_y)
  25.  
  26.      int
  27.      MMiigg__CCoonnffiirrmmIIddllee(_s_p_r_i_t_e_I_D)
  28.  
  29.      int
  30.      MMiigg__RReettuurrnnHHoossttss(_n_u_m_H_o_s_t_s, _h_o_s_t_A_r_r_a_y)
  31.  
  32.      int
  33.      MMiigg__DDeelleetteeHHoosstt(_s_p_r_i_t_e_I_D)
  34.  
  35.      int
  36.      MMiigg__EEvviicctt()
  37.  
  38.      char *
  39.      MMiigg__GGeettPPddeevvNNaammee(_g_l_o_b_a_l)
  40.  
  41.      int
  42.      MMiigg__GGeettIIddlleeNNooddee()
  43.  
  44.      int
  45.      MMiigg__DDoonnee(_s_p_r_i_t_e_I_D)
  46.  
  47.  
  48. AARRGGUUMMEENNTTSS
  49.      int    _s_p_r_i_t_e_I_D           (in)      The  Sprite  ID  of  the
  50.                                          host  for which informa-
  51.                                          tion should be  obtained
  52.                                          or updated.
  53.  
  54.      Mig_Info                  _i_n_f_o_A_r_r_a_y[](out)
  55.                                          A   buffer    to    hold
  56.                                          Mig_Info         entries
  57.                                          returned     by      the
  58.                                          Mig_GetAllInfo  routine.
  59.                                          The size of  the  buffer
  60.  
  61.  
  62.  
  63. Sprite v.1.0         Printed:  April 5, 1990                    1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Mig                   C Library Procedures                    Mig
  71.  
  72.  
  73.  
  74.                                          is   specified   in  the
  75.                                          _n_u_m_H_o_s_t_s variable.
  76.  
  77.      int    _n_u_m_H_o_s_t_s           (in)      The number  of  Mig_Info
  78.                                          structures  contained in
  79.                                          _i_n_f_o_A_r_r_a_y.    Or,    the
  80.                                          number      of     hosts
  81.                                          requested           from
  82.                                          MMiigg__RReeqquueessttIIddlleeHHoossttss and
  83.                                          the  number   of   hosts
  84.                                          returned              to
  85.                                          MMiigg__RReettuurrnnIIddllee.
  86.  
  87.      int    _p_r_i_o_r_i_t_y           (in)      Priority of processes to
  88.                                          be   migrated   to  idle
  89.                                          hosts (see below).
  90.  
  91.      int    _f_l_a_g_s              (in)      Flags to  be  passed  to
  92.                                          the   migration   daemon
  93.                                          (see below).
  94.  
  95.      void   (*_c_a_l_l_B_a_c_k_P_t_r)()   (in)      Routine to call  if  not
  96.                                          enough  hosts are avail-
  97.                                          able   and    additional
  98.                                          hosts  are  later avail-
  99.                                          able.
  100.  
  101.      int    _g_l_o_b_a_l             (in)      Whether  to  return  the
  102.                                          name   of   the  pseudo-
  103.                                          device  for  the  global
  104.                                          daemon  or host-specific
  105.                                          daemon.
  106.  
  107. _________________________________________________________________
  108.  
  109. DDEESSCCRRIIPPTTIIOONN
  110.      These functions are used to obtain (or  update)  information
  111.      about  hosts  on  the Sprite network.  There are routines to
  112.      get information about specific hosts or all the hosts on the
  113.      network, to select one or more idle hosts for process migra-
  114.      tion, to cause processes to be evicted, or to  remove  hosts
  115.      that are down from the list of hosts on the network.
  116.  
  117.      Most of the routines interact  with  a  single  network-wide
  118.      daemon, known as the _g_l_o_b_a_l _d_a_e_m_o_n, to obtain information or
  119.      make requests.  This mmiiggdd daemon maintains state  about  all
  120.      hosts  on  the  network, including their load averages, idle
  121.      time, and availability for use with  migration.    In  addi-
  122.      tion,  each  host runs a per-host instance of mmiiggdd that sam-
  123.      ples load and evicts processes automatically when it detects
  124.      user input.    The MMiigg library opens a pseudo-device to com-
  125.      municate with the appropriate mmiiggdd daemon (global or  local)
  126.      depending  on  the  operation  being performed.  Also, if an
  127.      error occurs communicating with a daemon,  the  MMiigg  library
  128.  
  129.  
  130.  
  131. Sprite v.1.0         Printed:  April 5, 1990                    2
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. Mig                   C Library Procedures                    Mig
  139.  
  140.  
  141.  
  142.      reestablishes communication.
  143.  
  144. GGEETTTTIINNGG HHOOSSTT IINNFFOORRMMAATTIIOONN
  145.      The migration daemon, and the migration library, communicate
  146.      using  a  structure  defined  in mig.h, known  as a Mig_Info
  147.      structure. Each host has  a  Mig_Info  structure  associated
  148.      with  it.   The  structure  has  another  structure included
  149.      within it; the Mig_LoadVector is updated periodically by the
  150.      mmiiggdd  process  on  each  host.   The  rest  of the data in a
  151.      Mig_Info structure are established at boot-time or are main-
  152.      tained by the global daemon.
  153.  
  154.      The global daemon maintains the state  of  each  host.   The
  155.      states  are  defined  in mig.h.  The most important ones are
  156.      MIG_HOST_DOWN, which indicates that the rest of the Mig_Info
  157.      structure    is    irrelevant    with   the   exception   of
  158.      loadVec.timestamp, which indicates when the  host  was  last
  159.      up;  MIG_HOST_IDLE,  indicating that a host is available for
  160.      migration; MIG_HOST_FULL,  which  shows  that  the  host  is
  161.      accepting  migration  but already has foreign processes; and
  162.      MIG_HOST_ACTIVE, which indicates that  a  user  is  actively
  163.      using  the machine or the machine's load is too high to per-
  164.      mit foreign processes.
  165.  
  166.      The load vector includes weighted average  CPU  utilizations
  167.      and ready-queue lengths, as well as the time since input was
  168.      last received from users directly logged into  the  machine.
  169.      (Remote  logins  do  not  affect  idle time.)  Finally, each
  170.      entry indicates  whether  the  host  is  willing  to  accept
  171.      processes for migration.   mmiiggdd is responsible for determin-
  172.      ing whether migration is allowed, based on factors  such  as
  173.      load and idle time.
  174.  
  175.      MMiigg__GGeettIInnffoo(()) returns a  pointer  to  a  Mig_Info  structure
  176.      based  on  the  sprite ID of a host. The structure is stati-
  177.      cally allocated by Mig_GetInfo,  and  the  contents  of  the
  178.      structure may change on subsequent calls to Mig_GetInfo.  On
  179.      error, a NULL pointer is returned.
  180.  
  181.      MMiigg__GGeettAAllllIInnffoo(()) returns an array  of  Mig_Info  structures.
  182.      The  array must be allocated by the caller, and a pointer to
  183.      the array must be passed to MMiigg__GGeettAAllllIInnffoo(()), along with the
  184.      size  of the array.  The number of entries filled in infoAr-
  185.      ray iiss rreettuurrnneedd..  OOnn eerrrroorr,, --11 iiss rreettuurrnneedd  aanndd  tthhee  gglloobbaall
  186.      vvaarriiaabbllee _e_r_r_n_o iinnddiiccaatteess tthhee nnaattuurree ooff tthhee eerrrroorr..
  187.  
  188. GGEETTTTIINNGG IIDDLLEE HHOOSSTTSS
  189.      The global daemon maintains open connections  to  both  per-
  190.      host  mmiiggdd  daemons  and  user processes that are using idle
  191.      hosts.  User processes can request idle hosts using  any  of
  192.      three priorities, MIG_LOW_PRIORITY, MIG_NORMAL_PRIORITY, and
  193.      MIG_HIGH_PRIORITY.   MIG_LOW_PRIORITY  is  for  long-running
  194.  
  195.  
  196.  
  197. Sprite v.1.0         Printed:  April 5, 1990                    3
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. Mig                   C Library Procedures                    Mig
  205.  
  206.  
  207.  
  208.      background  processes  that  are  to be run at low execution
  209.      priority.  MIG_NORMAL_PRIORITY  is  for  normal,  relatively
  210.      short-lived  processes  such as compiles.  MIG_HIGH_PRIORITY
  211.      is not yet in general use.  Hosts with foreign processes  of
  212.      one  priority  can  still  accept  more  processes of higher
  213.      priority, so simulations won't interfere with compiles.
  214.  
  215.      Processes communicate with the global daemon  using  ioctls,
  216.      and  normally,  those  streams  are not readable. The global
  217.      daemon makes the streams readable to indicate that a  change
  218.      of  state  has occurred.  The MMiigg library relies on sseelleecctt(())
  219.      to determine whether the global daemon has information about
  220.      changes.   In this way, communication with the daemon may be
  221.      minimized, since applications can check for new  idle  hosts
  222.      or evictions on hosts they were using, without ever communi-
  223.      cating with the daemon.
  224.  
  225.      MMiigg__RReeqquueessttIIddlleeHHoossttss(()) requests one or more idle hosts  from
  226.      the  global  daemon.    The  number  of  hosts  available is
  227.      returned.  The _p_r_i_o_r_i_t_y must be  specified  as  one  of  the
  228.      priorities   listed   above.    The   _f_l_a_g_s   may  be  0  or
  229.      MIG_PROC_AGENT, which indicates that the process  requesting
  230.      the host will not indicate when the processes being migrated
  231.      are through, and instead the hosts to  which  the  processes
  232.      are  migrated should monitor foreign processes and note when
  233.      they are no longer in use for migration.    The  _c_a_l_l_B_a_c_k_P_t_r
  234.      may  be  NULL  or  a pointer to a void function that will be
  235.      invoked when additional hosts are available, if an  insuffi-
  236.      cient  number  of  hosts are granted by the global daemon at
  237.      the time of the call.  _h_o_s_t_A_r_r_a_y points to an area that  can
  238.      hold up to _n_u_m_H_o_s_t_s host identifiers.
  239.  
  240.      MMiigg__CCoonnffiirrmmIIddllee((_h_o_s_t_I_D)) verifies that a host is still avail-
  241.      able.  If the host is available, MMiigg__CCoonnffiirrmmIIddllee(()) returns 1
  242.      (TRUE).  If the host is not available, or an  error  occurs,
  243.      MMiigg__CCoonnffiirrmmIIddllee(())  returns  0  (FALSE).   In  this case, the
  244.      caller may request a new idle host.
  245.  
  246.      MMiigg__RReettuurrnnHHoossttss(()) returns one or  more  idle  hosts  to  the
  247.      pool.   Note:  all hosts requested by a process are returned
  248.      to the pool of idle hosts when the stream that connects  the
  249.      process  to the global daemon is closed (i.e., when the pro-
  250.      cess and all its children that may have inherited the stream
  251.      have exited).
  252.  
  253. BBAACCKKWWAARRDD CCOOMMPPAATTIIBBIILLIITTYY
  254.      Two functions are implemented to provide a backward compati-
  255.      ble interface for users of the original MMiigg library.
  256.  
  257.      MMiigg__GGeettIIddlleeNNooddee(()) returns the number of an idle node.  If no
  258.      host  is  available,  then  0  is returned.  On error, -1 is
  259.      returned and the global variable _e_r_r_n_o indicates the  nature
  260.  
  261.  
  262.  
  263. Sprite v.1.0         Printed:  April 5, 1990                    4
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270. Mig                   C Library Procedures                    Mig
  271.  
  272.  
  273.  
  274.      of the error.
  275.  
  276.      MMiigg__DDoonnee(()) returns a single host to the pool of idle hosts.
  277.  
  278. MMIISSCCEELLLLAANNEEOOUUSS
  279.      MMiigg__DDeelleetteeHHoosstt(()) removes a host from the database maintained
  280.      by  the  global  daemon.  The host must be down at the time.
  281.      This may be used if a host is removed from  the  network  or
  282.      renamed.
  283.  
  284.      MMiigg__EEvviicctt(()) performs an _i_o_c_t_l  to  the  local  mmiiggdd  daemon,
  285.      requesting  that  it evict any foreign processes.  Normally,
  286.      eviction is automatic when a host becomes active after being
  287.      idle.   This  routine  provides the llooaaddaavvgg program with the
  288.      ability to request evictions at other  times  (for  example,
  289.      from a remote login).
  290.  
  291.      MMiigg__GGeettPPddeevvNNaammee(()) is used by the migration  library  and  by
  292.      mmiiggdd  to  get  the name of pseudo-devices to open.  It would
  293.      not normally be used by other programs.
  294.  
  295. DDIIAAGGNNOOSSTTIICCSS
  296.      Most MMiigg routines return zero if all went  well.   Otherwise
  297.      they  return  -1  and the _e_r_r_n_o variable contains additional
  298.      information about what  error  occurred.   MMiigg__GGeettIIddlleeNNooddee(())
  299.      and  MMiigg__RReeqquueessttIIddlleeHHoossttss(())    similarly return -1 on error,
  300.      but  they  return  0  if  no   idle   host   is   available.
  301.      MMiigg__GGeettIInnffoo(()) returns NULL on error.
  302.  
  303. FFIILLEESS
  304.      /sprite/admin/migd.log
  305.           The global migration daemon error log.
  306.  
  307.      /hosts/$HOST/migd.log
  308.           The error log used by host $HOST.
  309.  
  310.      /sprite/admin/migInfo.pdev
  311.           The pseudo-device used to communicate with  the  global
  312.           daemon.
  313.  
  314.      /hosts/$HOST/migInfo.pdev
  315.           The pseudo-device used to communicate  with  the  local
  316.           daemon.
  317.  
  318.      /sprite/admin/migd.check
  319.           The file used to  store  the  most  recent  information
  320.           about host uptimes.
  321.  
  322. KKEEYYWWOORRDDSS
  323.      migration, load average, idle time, pseudo-device, eviction
  324.  
  325.  
  326.  
  327.  
  328.  
  329. Sprite v.1.0         Printed:  April 5, 1990                    5
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336. Mig                   C Library Procedures                    Mig
  337.  
  338.  
  339.  
  340. SSEEEE AALLSSOO
  341.      migd, loadavg, pmake, pdev
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395. Sprite v.1.0         Printed:  April 5, 1990                    6
  396.  
  397.  
  398.  
  399.